import java.util.*;


public class Solution1 {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param a int整型ArrayList 
     * @return int整型ArrayList
     */
    public static ArrayList<Integer> newArray (ArrayList<Integer> a) {
        // write code here
        ArrayList<Integer> res = new ArrayList<>();
        for(int i = 0;i<a.size();i++){
            Integer ret = fun(a.get(i));
            if(ret != null){
                res.add(ret);
            }
        }
        return res;
    }


    private static Integer fun(Integer ret) {
        String tmp = ret.toString();
        StringBuilder s = new StringBuilder(tmp);
        for(int i = 0;i<s.length();i++){
            if(s.charAt(i) == '2'){
                s.deleteCharAt(i);
                i--;
            }
        }
        if(s.length() == 0){
            return null;
        }
        while (s.length()>1 && s.charAt(0) == '0'){
            s.deleteCharAt(0);
        }
        return Integer.valueOf(new String(s));
    }

    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(12212);list.add(58);list.add(2001);list.add(2);list.add(77);
        newArray(list);

    }
}